package org.abettor.pushbox.activity;

import java.util.List;

import org.abettor.pushbox.download.DownloadMap;
import org.abettor.pushbox.map.Boxmap;
import org.abettor.pushbox.map.BoxmapUtil;
import org.abettor.pushbox.map.Step;

import android.content.Intent;
import android.os.Bundle;

public class QuesstionShowNetResultActivity extends AbstractShowResultActivity {
	private int map_id = -1;// 地图的id
	private int result_id = -1;

	@Override
	protected Boxmap initMap() {
		Intent intent = getIntent();
		Bundle extras = intent.getExtras();
		map_id = extras.getInt("_id");// 获得数据的id
		DownloadMap down = new DownloadMap(this);
		byte [] buf = down.readMapFromNetOrLocal(map_id);
		return BoxmapUtil.paraArrayToMap(buf);
	}
	/**
	 * 加载地图步骤的操作
	 */
	@Override
	protected List<Step> initStep() {
		DownloadMap down = new DownloadMap(this);
		Intent intent = getIntent();
		Bundle extras = intent.getExtras();
		result_id = extras.getInt("result_id");// 获得数据的id
		byte [] buf = down.readAnswerFromNet(result_id);
		if(buf==null){
			return null;
		}
		return BoxmapUtil.paraArrayToStep(buf);
	}

}
